package com.kolalo.annotation.qualifier.phone;

import com.kolalo.annotation.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class QualifierAnnotation {
    @Autowired
    @Qualifier("apple")
    private Product apple;
    public Product getApple() {
        return apple;
    }
    public void setApple(Product apple) {
        this.apple = apple;
    }

    @Autowired
    @AppleProductQualifier("appleQualifier")
    private Product appleQualifier;
    public Product getAppleQualifier() {
        return appleQualifier;
    }
    public void setAppleQualifier(Product appleQualifier) {
        this.appleQualifier = appleQualifier;
    }

    @Autowired
    @Qualifier("sum")
    private Product sum;
    public Product getSum() {
        return sum;
    }
    public void setSum(Product sum) {
        this.sum = sum;
    }

    @Autowired
    @SumProductQualifier
    private Product sumQualifier;
    public Product getSumQualifier() {
        return sumQualifier;
    }
    public void setSumQualifier(Product sumQualifier) {
        this.sumQualifier = sumQualifier;
    }

    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("QualifierAnnotationConfig.xml");
        QualifierAnnotation annotation=context.getBean(QualifierAnnotation.class);
        System.out.println(annotation.getApple());
        System.out.println(annotation.getAppleQualifier());
        System.out.println(annotation.getSumQualifier());
    }
}

